using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace NetworkPower.Data.Models.Mapping
{
    public class ProjectMap : EntityTypeConfiguration<Project>
    {
        public ProjectMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ProjectID, t.ProjectName });

            // Properties
            this.Property(t => t.ProjectName)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.ProjectNumber)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Projects");
            this.Property(t => t.ProjectID).HasColumnName("ProjectID");
            this.Property(t => t.ProjectName).HasColumnName("ProjectName");
            this.Property(t => t.ProjectNumber).HasColumnName("ProjectNumber");
        }
    }
}
